package edu.washington.ling.syntric.io;

import edu.washington.ling.syntric.struct.error.InvalidValueException;
import edu.washington.ling.syntric.struct.rule.BiDSPattern;
import edu.washington.ling.syntric.struct.rule.BiRule;
import edu.washington.ling.syntric.struct.rule.UniDSPattern;
import edu.washington.ling.syntric.struct.rule.UniRule;

public abstract class RuleWriter {

	public static RuleWriter newWriter(String format) throws InvalidValueException {
		RuleWriter rw;
		if (format.equals("text"))
			rw = new RuleWriterText();
		else if (format.equals("latex"))
			rw = new RuleWriterLaTeX();
		else {
			String[] possibleFormats = {"text", "latex"};
			throw new InvalidValueException("Specified rule format unknown.", format, possibleFormats);
		}
		return rw;
	}
	public abstract String writeUnaryDSPattern(UniDSPattern pattern);
	public abstract String writeBinaryDSPattern(BiDSPattern pattern);
	public abstract RuleRepresentation writeUnaryRule(UniRule rule);
	public abstract RuleRepresentation writeBinaryRule(BiRule rule);
}
